<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header">
</head>
<link rel="stylesheet" th:href="@{/css/yw.css}">
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header">
    <h1 th:if=" ${kind} == 0">
        预算成本数据编辑
    </h1>
    <h1 th:if=" ${kind} == 1">
        核算成本数据编辑
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm11" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目编号：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px;text-align: center;" th:text="${code}"></span>
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目名称：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px;text-align: center;" th:text="${name}"></span>
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目数量：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px;text-align: center;" th:text="${num}"></span>
                                </div>
                            </div>
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;需方：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px;text-align: center;" th:text="${demander}"></span>
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>安装地点：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px;text-align: center;" th:text="${address}"></span>
                                </div>

                                <div class="form-group" style="margin-right: 10px;margin-top: 5px;">
                                    <label>设计类别：</label>
                                    <span class="form-control" style="border:none;border-bottom: solid 1px #eee; width: 300px; text-align: center;" th:text="${projectClassify}"></span>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table" style="table-layout: fixed;word-break:break-all; word-wrap:break-word;"></table>
                </div>
                <form id="queryForm" onsubmit="return false;">
                    <input id="kind" name="kind" type="hidden" th:value="${kind}"/>
                    <input id="designType" name="designType" type="hidden" th:value="${designType}"/>
                    <input id="id" name="id" type="hidden" th:value="${id}"/>

                    <input id="code" name="code" type="hidden" th:value="${code}"/>
                    <input id="name" name="name" type="hidden" th:value="${name}"/>
                    <input id="num" name="num" type="hidden" th:value="${num}"/>
                    <input id="demander" name="demander" type="hidden" th:value="${demander}"/>
                    <input id="address" name="address" type="hidden" th:value="${address}"/>
                    <input id="projectClassify" name="projectClassifyNG" type="hidden" th:value="${projectClassify}"/>
                </form>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer">
</div>
<!--<script th:src="@{/js/yw.js}"></script>-->
<script th:inline="javascript">

    /**
     * 表格搜索
     */
    $("#btn-search").click(function () {
        js.table.search(table);
    });

    /** 加载用户表格 */
    table = js.table.init({
        url: ctx + "baseCost/costSubList",
        // data:$("#paramData").serialize(),
        showColumns: false,
        showExport: false,
        pageSize:300,
        columns: [
            {
                title: '序号', field: 'id', width: '50',
                formatter: function (value, row, index, field) {
                    var pageSize = table.bootstrapTable('getOptions').pageSize;
                    var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                    return pageSize * (pageNumber - 1) + index + 1;
                }
            },

            { title: "设计专业", field: 'ptype',
                formatter: function(value, row, index){
                    if(value==1){
                        return '机械';
                    }else if(value==2){
                        return '自动化';
                    }else{
                        return '流体';
                    }
                }
            },
            { title: "部位名称", field: 'partName'},
            { title: "数据名称", field: 'dataName'},
            { title: "文件名称", field: 'fileName'},
            { title: "填报部门（填报人）", field: 'deptInfo'},
            { title: "填报人", field: 'inputUser'},
            { title: "填报人时间", field: 'editDate'},
            { title: "数据状态", field: 'costId',
                formatter: function(value, row, index){
                    var actions = [];
                    if( value==null || value==''){
                        actions.push('<a class="label  badge  label-default" href="javascript:void(0)"> 未编辑</a> ');
                    }else{
                        actions.push('<a class="label  badge  label-success" href="javascript:void(0)"> 已编辑</a> ');
                    }
                    return actions.join('');
                }
            },
            { title: "接收状态", field: 'isReceive',
                formatter: function(value, row, index){
                    var actions = [];
                    if(value==1){
                        actions.push('<a class="label  badge  label-success" href="javascript:void(0)"> 已接收</a> ');
                    }else{
                        actions.push('<a class="label  badge  label-default" href="javascript:void(0)"> 未接收</a> ');
                    }
                    return actions.join('');
                }
            },
            { title: "操作", field: 'inputId',
                formatter: function(value, row, index){
                    var actions = [];
                    actions.push('<a class="btn btn-warning btn-xs" href="' + ctx + 'LookCostInfo?id= ' + row.costId + '&fkId='+$("#id").val()+'&code='+ $("#code").val() + '&name='+ $("#name").val() + '&demander='+ $("#demander").val()+ '&num='+ $("#num").val() + '&address='+ $("#address").val() + '&projectClassifyName='+$("#projectClassify").val() + '&kind='+$("#kind").val()+'&designType='+$("#designType").val()+'&inputId='+row.inputId+'&partName='+row.partName+'&costKind='+row.dataName+'"> 查看</a> ');

                     return actions.join('');
                }
            }
        ]
    });
</script>